import JSEncrypt from "jsencrypt";

const pk = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIjPTGjvXCaxJKUrOVirONPytr
mHB0rvtc7BTu2r8nyepQSPAapUcSQpaPQ1bMb60wDPITpbnOxl5YgclQsHYcInxM
m+jFUw7vsR8oC8s3z9fU7N9Apso1n9xsGJBUCWDf166M5FG1xWHrCLUeiaGRgtRM
aYSc0xxhnvfBvHhVCQIDAQAB
-----END PUBLIC KEY-----`;

export const rsaEncode = (data: string) => {
  const encrypt = new JSEncrypt({});
  encrypt.setPublicKey(pk);
  return encrypt.encrypt(data);
};
